﻿using UnityEditor;
using UnityEngine;

/// <summary>
/// Inspector 变量绘制指定文字
/// </summary>
[CustomPropertyDrawer(typeof(LablelAttribute))]
public class LabelAttributeDrawer : PropertyDrawer
{

    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        LablelAttribute lablelAttribute = attribute as LablelAttribute;
        if (!lablelAttribute.Name.IsNullOrEmpty())
        {
            label.text = lablelAttribute.Name;
        }
        EditorGUI.PropertyField(position, property, label);
    }
}
